
// 存放病房相关的数据
export default {
    //开启命名空间，解决不同模块之间成员冲突的问题
    namespaced: true,
    state: {
        // 病房信息
        room: [
            { roomID: '201', type: '普通病房', patientID: ['3001', '3002', '3003', ''], nurseID: '2001' },
            { roomID: '202', type: '普通病房', patientID: ['', '3005', '3015', '3017'], nurseID: '2003' },
            { roomID: '203', type: '普通病房', patientID: ['3015', '3022', '3006', '3023'], nurseID: '2017' },
            { roomID: '204-207', type: '单人病房', patientID: ['', '3018', '3007', ''], nurseID: '2012' },
            { roomID: '208-211', type: '单人病房', patientID: ['', '', '', ''], nurseID: '2025' },
            { roomID: '301', type: '普通病房', patientID: ['', '3017', '3016', '3008'], nurseID: '2011' },
            { roomID: '302', type: '普通病房', patientID: ['', '', '', '3012'], nurseID: '2002' },
            { roomID: '303', type: '普通病房', patientID: ['', '3004', '', ''], nurseID: '2006' },
            { roomID: '304-307', type: '单人病房', patientID: ['', '', '', '3021'], nurseID: '2010' },
            { roomID: '308-311', type: '单人病房', patientID: ['3011', '', '', ''], nurseID: '2012' },
            { roomID: '401', type: '普通病房', patientID: ['', '', '3013', '3007'], nurseID: '2005' },
            { roomID: '402', type: '普通病房', patientID: ['3020', '3022', '', ''], nurseID: '2020' },
            { roomID: '403', type: '普通病房', patientID: ['', '3024', '', '3010'], nurseID: '2004' },
            { roomID: '404-407', type: '单人病房', patientID: ['', '3018', '3026', ''], nurseID: '2018' },
            { roomID: '408-411', type: '单人病房', patientID: ['3025', '', '', ''], nurseID: '2014' },
            { roomID: '501', type: '普通病房', patientID: ['3014', '', '', ''], nurseID: '2009' },
            { roomID: '502', type: '普通病房', patientID: ['', '', '', ''], nurseID: '2030' },
            { roomID: '503', type: '普通病房', patientID: ['', '3019', '3009', ''], nurseID: '2008' }
        ],
    },

    getters: {

        //获取护士ID
        getRoomByNurseID: state => nurseID => {
            for (const room of state.room) {
                if (room.nurseID === nurseID) {
                    return room;
                }
            } return null;
        }

    },

    mutations: {
    },

    actions: {
    }
}
